package main

import (
	"github.com/sirupsen/logrus"
	"image/color"
	"treesize/src/org/ligson/treesize/gui"
	"treesize/src/org/ligson/treesize/util"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/theme"
)

type MyTheme struct{}

var _ fyne.Theme = (*MyTheme)(nil)

// Font return bundled font resource
func (*MyTheme) Font(s fyne.TextStyle) fyne.Resource {
	if s.Monospace {
		return theme.DefaultTheme().Font(s)
	}
	if s.Bold {
		if s.Italic {
			return theme.DefaultTheme().Font(s)
		}
		return resourceMsyhTtf
	}
	if s.Italic {
		return theme.DefaultTheme().Font(s)
	}
	return resourceMsyhTtf
}

func (*MyTheme) Color(n fyne.ThemeColorName, v fyne.ThemeVariant) color.Color {
	return theme.DefaultTheme().Color(n, v)
}

func (*MyTheme) Icon(n fyne.ThemeIconName) fyne.Resource {
	return theme.DefaultTheme().Icon(n)
}

func (*MyTheme) Size(n fyne.ThemeSizeName) float32 {
	return theme.DefaultTheme().Size(n)
}

func action() error {
	return gui.OpenWin(&MyTheme{})
}
func main() {

	util.ConfigLog()
	err := action()
	if err != nil {
		logrus.Error(err)
	}
	/*app := new(cli.App)
	app.Name = "TreeSize"
	app.Version = "1.0"
	app.Usage = "run"
	app.Action = action
	err := app.Run(os.Args)
	if err != nil {
		logrus.Error(err)
	}*/

}
